package com.ruoyi.web.controller.system;

import java.util.List;

import com.ruoyi.common.core.domain.entity.UkDll;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.service.IUkDllService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * UK型号Controller
 * 
 * @author ess
 * @date 2021-10-18
 */
@RestController
@RequestMapping("/system/ukDll")
public class UkDllController extends BaseController
{
    @Autowired
    private IUkDllService ukDllService;

    /**
     * 查询UK型号列表
     */
    @PreAuthorize("@ss.hasPermi('system:ukDll:list')")
    @GetMapping("/list")
    public TableDataInfo list(UkDll ukDll)
    {
        startPage();
        List<UkDll> list = ukDllService.selectUkDllList(ukDll);
        return getDataTable(list);
    }

    /**
     * 导出UK型号列表
     */
    @PreAuthorize("@ss.hasPermi('system:ukDll:export')")
    @Log(title = "UK型号", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(UkDll ukDll)
    {
        List<UkDll> list = ukDllService.selectUkDllList(ukDll);
        ExcelUtil<UkDll> util = new ExcelUtil<UkDll>(UkDll.class);
        return util.exportExcel(list, "UK型号数据");
    }

    /**
     * 获取UK型号详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:ukDll:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(ukDllService.selectUkDllById(id));
    }

    /**
     * 新增UK型号
     */
    @PreAuthorize("@ss.hasPermi('system:ukDll:add')")
    @Log(title = "UK型号", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody UkDll ukDll)
    {
        return toAjax(ukDllService.insertUkDll(ukDll));
    }

    /**
     * 修改UK型号
     */
    @PreAuthorize("@ss.hasPermi('system:ukDll:edit')")
    @Log(title = "UK型号", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody UkDll ukDll)
    {
        return toAjax(ukDllService.updateUkDll(ukDll));
    }

    /**
     * 删除UK型号
     */
    @PreAuthorize("@ss.hasPermi('system:ukDll:remove')")
    @Log(title = "UK型号", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(ukDllService.deleteUkDllByIds(ids));
    }
}
